package Enum;
/*本类用于实现枚举实现接口*/
public class Demo03 {
    public static void main(String[] args) {
        Game.ROCK.show();//猜丁壳出的是石头
        Game.SCISSORS.show();//猜丁壳出的是剪刀
        Game.PAPER.show();//猜丁壳出的是布

        System.out.println(Game.ROCK.getName());//石头
        System.out.println(Game.ROCK.getNum());//0
    }
}
interface Info{
    void show();
}
enum Game implements Info {
    ROCK("石头", 0) {
        @Override
        public void show() {

        }
    },
    SCISSORS("剪刀", 2) {
        public void show() {
            System.out.println("猜丁壳出的是剪刀");
        }
    },
    PAPER("布", 5) {
        public void show() {
            System.out.println("猜丁壳出的是布");
        }
    };
    //3.定义本类的属性
    private final String name;
    private final int num;

    //4.创建本类的构造函数
    private Game(String name, int num) {
        this.name = name;
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public int getNum() {
        return num;
    }
}